package com.lcm.basic.p7.set.bean;

import java.time.Period;
import java.util.Objects;

/**
 * @author Coder-lcm
 * @date 2021/4/3
 */
public class Person {
    private int id;
    private String name;

    public Person(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
       if (o == null) {
           return false;
       }
       if (o instanceof  Person) {
           Person tmp = (Person) o;
           if (this.id == tmp.id && this.name.equals(tmp.name)) {
               return true;
           }
       }
       return false;
    }


    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }


    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
